<?php

namespace app\controller\Admin;

use think\Controller;
use think\facade\Db;
use think\facade\Request;

class ProductSolution extends Controller
{
    /**
     * 获取产品方案配置
     * @return \think\response\Json
     */
    public function getConfig()
    {
        $config = Db::table('product_solution_config')->find();
        return json($config);
    }

    /**
     * 保存产品方案配置
     * @return \think\response\Json
     */
    public function saveConfig()
    {
        $data = Request::post();
        if (isset($data['id'])) {
            Db::table('product_solution_config')->where('id', $data['id'])->update($data);
        } else {
            Db::table('product_solution_config')->insert($data);
        }
        return json(['code' => 200, 'msg' => '保存成功']);
    }
}
